<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>body中的JavaScript</title>
</head>

<body>
    <h2>Body 中的 JavaScript</h2>
    <p id="demo">一个段落。</p>
    <button type="button" onclick="myFunction()">试一试</button>
    <script>
        function myFunction() {
            document.getElementById("demo").innerHTML = "段落已被更改。";
        }
    </script>
</body>

</html>